#!/bin/bash
#zabbix监控场点前60分钟人数是否异常
#广东省政府住宅大院
#SZFJSY=`mysql -uroot -p1234-qwer -h10.64.2.234 -N -e "select ifnull(sum(success),0) from IGD_Analysis.FactAuthSummary_RT where time >=(now() - interval 60 minute) and time <now() and userlocation = 'IGD_RUCKUSZD_SZFJSY';"`
SZFJSY=`mysql -uroot -p1234-qwer -h10.64.2.10 -N -e "select ifnull(sum(success),0) from IGD_Analysis.FactAuthSummary_RT where time >=(now() - interval 60 minute) and time <now() and userlocation = 'SITE-GN1003-SZFJSY';"`

#广东省经信委
#GDJXW=`mysql -uroot -p1234-qwer -h10.64.2.234 -N -e "select ifnull(sum(success),0) from IGD_Analysis.FactAuthSummary_RT where time >=(now() - interval 60 minute) and time <now() and userlocation = 'IGD_RUCKUSZD_GDJXW';"`
GDJXW=`mysql -uroot -p1234-qwer -h10.64.2.10 -N -e "select ifnull(sum(success),0) from IGD_Analysis.FactAuthSummary_RT where time >=(now() - interval 60 minute) and time <now() and userlocation = 'SITE-GN1001-GDJXW';"`

#九记牛腩
#IGD_RUCKUS_JJNN=`mysql -uroot -p1234-qwer -h10.64.2.234 -N -e "select ifnull(sum(success),0) from IGD_Analysis.FactAuthSummary_RT where time >=(now() - interval 60 minute) and time <now() and userlocation = 'IGD_RUCKUS_JJNN';"`

#荔湾区图书馆
#IGD_RUCKUS_LWQTSG=`mysql -uroot -p1234-qwer -h10.64.2.234 -N -e "select ifnull(sum(success),0) from IGD_Analysis.FactAuthSummary_RT where time >=(now() - interval 60 minute) and time <now() and userlocation = 'IGD_RUCKUS_LWQTSG';"`

#广州市电子政务公共服务大厅
#IGD_RUCKUS_GZDZZW=`mysql -uroot -p1234-qwer -h10.64.2.234 -N -e "select ifnull(sum(success),0) from IGD_Analysis.FactAuthSummary_RT where time >=(now() - interval 60 minute) and time <now() and userlocation = 'IGD_RUCKUS_GZDZZW';"`

#办公室
#IGD_RUCKUS_GZOFFICE=`mysql -uroot -p1234-qwer -h10.64.2.234 -N -e "select ifnull(sum(success),0) from IGD_Analysis.FactAuthSummary_RT where time >=(now() - interval 60 minute) and time <now() and userlocation = 'IGD_RUCKUS_GZOFFICE';"`

#正佳广场
#ZHENGJIA=`mysql -uroot -p1234-qwer -h10.64.2.234 -N -e "select ifnull(sum(success),0) from IGD_Analysis.FactAuthSummaryVendor_RT where time >=(now() - interval 60 minute) and time <now() and Vendor = 'SITE-0002-ZHENGJIA';"`
#ZHENGJIA=`mysql -uroot -p1234-qwer -h10.64.2.10 -N -e "select ifnull(sum(success),0) from IGD_Analysis.FactAuthSummaryVendor_RT where time >=(now() - interval 60 minute) and time <now() and Vendor = 'ZHENGJIA';"`


#环迅
#HUANXUN=`mysql -uroot -p1234-qwer -h10.64.2.234 -N -e "select ifnull(sum(success),0) from IGD_Analysis.FactAuthSummaryVendor_RT where time >=(now() - interval 60 minute) and time <now() and Vendor = 'SITE-0001-HUANXUN';"`
HUANXUN=`mysql -uroot -p1234-qwer -h10.64.2.10 -N -e "select ifnull(sum(success),0) from IGD_Analysis.FactAuthSummaryVendor_RT where time >=(now() - interval 60 minute) and time <now() and Vendor = 'HUANXUN';"`

#风寻自建
#WINDFIND=`mysql -uroot -p1234-qwer -h10.64.2.234 -N -e "select ifnull(sum(success),0) from IGD_Analysis.FactAuthSummaryVendor_RT where time >=(now() - interval 60 minute) and time <now() and Vendor = 'SITE-0001-WINDFIND';"`
WINDFIND=`mysql -uroot -p1234-qwer -h10.64.2.10 -N -e "select ifnull(sum(success),0) from IGD_Analysis.FactAuthSummaryVendor_RT where time >=(now() - interval 60 minute) and time <now() and Vendor = 'WINDFIND';"`

# echo IGD_RUCKUS_GZDZZW is ${IGD_RUCKUS_GZDZZW}
# echo IGD_RUCKUS_JJNN is ${IGD_RUCKUS_JJNN}
# echo IGD_RUCKUS_LWQTSG is ${IGD_RUCKUS_LWQTSG}
# echo IGD_RUCKUSZD_GDJXW is ${IGD_RUCKUSZD_GDJXW}
# echo IGD_RUCKUSZD_SZFJSY is ${IGD_RUCKUSZD_SZFJSY}
# echo SITE_0001_HUANXUN is ${SITE_0001_HUANXUN}
# echo SITE_0002_ZHENGJIA is ${SITE_0002_ZHENGJIA}
# echo SITE_0001_WINDFIND is ${SITE_0001_WINDFIND}


# zabbix_sender -s "IGDMonitor" -z 10.64.2.10 -k IGD_RUCKUS_GZDZZW -o ${IGD_RUCKUS_GZDZZW}
# zabbix_sender -s "IGDMonitor" -z 10.64.2.10 -k IGD_RUCKUS_JJNN -o ${IGD_RUCKUS_JJNN}
# zabbix_sender -s "IGDMonitor" -z 10.64.2.10 -k IGD_RUCKUS_LWQTSG -o ${IGD_RUCKUS_LWQTSG}
zabbix_sender -s "IGDMonitor" -z 10.64.2.10 -k GDJXW -o ${GDJXW}
zabbix_sender -s "IGDMonitor" -z 10.64.2.10 -k SZFJSY -o ${SZFJSY}
zabbix_sender -s "IGDMonitor" -z 10.64.2.10 -k HUANXUN -o ${HUANXUN}
#zabbix_sender -s "IGDMonitor" -z 10.64.2.10 -k ZHENGJIA -o ${ZHENGJIA}
zabbix_sender -s "IGDMonitor" -z 10.64.2.10 -k WINDFIND -o ${WINDFIND}
